class Token
{
public:
	virtual bool isOperator();
	virtual bool isOperand();
	virtual bool operator==(const Token t);
	virtual bool operator!=(const Token t);
	friend std::ostream &operator<<(std::ostream &os, const Token &t);
};

class Operand : public Token
{
private:
	double value;

public:
	Operand() : value(NULL) {}
	Operand(double val) : value(val) {}
	~Operand() {}
	const Operand & operator=(const Operand op)
	{
		this->value = op.value;
		return *this;
	}
	bool operator==(const Operand &op) { if(op.value == this->value) return true; else return false; }
	bool operator!=(const Operand &op) { return !(this->operator==(op)); }
	friend std::ostream &operator<<(std::ostream &os, const Operand &op) { os << op.value; return os; }

	bool isOperator() { return false; }
	bool isOperand() { return true; }
	double get() { return value; }
};

class Operator : public Token
{
private:
	char value;

public:
	Operator() : value(NULL) {}
	Operator(char val) : value(val) {}
	~Operator() {}
	const Operator & operator=(const Operator op)
	{
		this->value = op.value;
		return *this;
	}
	bool operator==(const Operator &op) { if(op.value == this->value) return true; else return false; }
	bool operator!=(const Operator &op) { return !(this->operator==(op)); }
	friend std::ostream &operator<<(std::ostream &os, const Operator &op) { os << op.value; return os; }

	bool isOperator() { return true; }
	bool isOperand() { return false; }
	char get() { return value; }

	double operate(double op1, double op2)
	{
		switch(value)
		{
		case '+':	return op1 + op2;
		}
	}
};